<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<table width="100%" cellpadding="0" cellspacing="0" align="left">
	<tr>
		<td align="left">

			<div>
				<img src="../images/sou.jpg" width="21" height="21">
				<input type="button" onclick="findInsert(1)" value="查询">

				<img src="../images/charu.jpg" width="21" height="21">
				<input type="button" onclick="findInsert(2)" value="插入">

			</div>
			<hr/>
		</td>

	</tr>
	<c:if test="${find_insert_id == 1}">
	<tr>
		<td width="100%">
			<form
				action="../chuliServlet?choice_id=<%=(String) session.getAttribute("choice_id")%>"
				method="post" name="formSubmit">
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td>
							按标题模糊查找:
							<input type="text" name="message" size="15">
							<jsp:include page="code.jsp"></jsp:include>
							&nbsp;&nbsp;<input type="button" value="查询" onclick="check()"/>
							<input type="reset" value="重置" />
						</td>
					</tr>
				</table>
			</form>
		</td>

	</tr>
	
	<tr>
		<td>
			<hr />
			<font>${title_show}搜索结果：</font>
			<hr />
		</td>
	</tr>
	</c:if>
	<c:if test="${find_insert_id == 2}">
		<tr>
			<td style="padding-top: 10">
				<span style="color: red">注意：</span>您要插入的内容类型为：
				<span style="color: red"><b>${title_show}</b></span> 若不符合要求，请重新选择！
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 3}">
		<tr>
			<td style="padding-top: 10">
				<span style="color: red">注意：</span>您要修改的内容类型为：
				<span style="color: red"><b>${title_show}</b></span> 若不符合要求，请重新选择！
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 6}">
		<tr>
			<td style="padding-top: 10">
				<span style="color: red">注意：</span>您要修改的内容类型为：
				<span style="color: red"><b>${title_show}</b></span> 若不符合要求，请重新选择！
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 4}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 5}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 7}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 8}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 9}">
		<tr>
			<td style="padding-top: 10">
				<span style="color: red">注意：</span>您要插入的内容类型为：
				<span style="color: red"><b>${title_show}</b></span> 若不符合要求，请重新选择！
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 10}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 11}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 12}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
	<c:if test="${find_insert_id == 13}">
		<tr>
			<td style="padding-top: 10">
				<span style="color:red">操作提示：</span>
			</td>
		</tr>
	</c:if>
</table>
<script type="text/javascript">
	function check() {
		var date_start = document.getElementById("date_start").value;
		var date_end = document.getElementById("date_end").value;

		if (date_start == "" && date_end == "") {
			document.formSubmit.submit();
		} else if (date_start == "" || date_end == "") {
			if (date_start == "") {
				alert("开始日期不能为空!");
			} else {
				alert("结束日期不能为空!");
			}
		} else {
			var flag = compare(date_start, date_end);
			if (flag) {
				document.formSubmit.submit();
			} else {
				alert("开始日期不能大于结束日期!");
			}
		}
	}

	function compare(date_start, date_end) {
		var date_start1 = date_start.split("-");
		var date_end1 = date_end.split("-");
		for (i = 0; i < date_start1.length; i++) {
			if (parseInt(date_start1[i]) < parseInt(date_end1[i])) {
				return true;
			}else if(i==2 && parseInt(date_start1[i]) == parseInt(date_end1[i])) {
				return true;
			}
		}
		return false;
	}
	
	function findInsert(sid) {
		location.href="../findOrInsert?sid="+sid;
	}
</script>
